<?php
include("libs/smarty.class.php");
include("functions.php");

$smarty = new Smarty();

$sql = mysql_query("SELECT p.id,p.add_date,p.date_start,p.date_end,p.amount,
    (SELECT name FROM companies co WHERE (p.company_id = co.id)) AS company_name,
    (SELECT city FROM cities ci WHERE (p.city_id = ci.id)) AS city
    FROM practices p LIMIT 0, 30 ");

$practices = array();

while($row = mysql_fetch_assoc($sql)){
    $practices[] = $row;

}

$smarty->assign("practices",$practices);
$smarty->display('show_practices.tpl');
?>
